<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'list.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript"
	src="<%=path%>/resources/js/jquery-1.8.3.min.js"></script>

<script type="text/javascript">
	function add(){
		location.href="<%=path%>/jsp/add.jsp";
	}
	<%-- function search(){
	alert("ok");
	var name= $("#bookName").val();
	alert(name);
	var bookName = $("#bookName").val();
 
		location.href="<%=path%>/book/all"+bookName;
	} --%>
</script>
</head>

<body>
	<form action="/BookManager/book/all?bookName" >
    <center>
	<h1>图书借阅系统-后台管理</h1>
	<span>图书名称：</span>
	<input id="bookName" name="bookName" type="text"  width="500px" />
	<input type="submit" value="查询"  onClick="search()" />
	<input type="button" value="新增" onClick="add()" />
	</center>
	</form>
	<table border="1px solid" align="center">
		<tr>
			<td>图书编号</td>
			<td>图书分类</td>
			<td>图书名称</td>
			<td>作者</td>
			<td>出版社</td>
			<td>入库时间</td>
			<td>是否借阅</td>
			<td>操作</td>
		</tr>
		<c:forEach items="${bookList}" var="item">
			<tr>
				<td>${item.bookCode}</td>
				<td>${item.type.typeName}</td>
				<td>${item.bookName}</td>
				<td>${item.bookAuthor}</td>
				<td>${item.publishPress}</td>
				<td>${item.creationTime }<%-- <fmt:formatDate value="${item.creationTime }"
						pattern="yyyy-MM-dd" /> --%>
				</td>
				<td><c:if test="${item.borrowed==1}">已借阅</c:if>
					<c:if test="${item.borrowed==0}">未借阅</c:if>
				</td>
				<td><a href="/BookManager/book/one?bookId=${item.bookId }">查看</a> 
				<a href="/BookManager/book/update?bookId=${item.bookId }">修改</a>
					<a href="/BookManager/book/delete?bookId=${item.bookId }">删除</a></td>
			</tr>
		</c:forEach>
	</table>
  </body>
</html>
